from django.shortcuts import render
from django.http import HttpResponse,JsonResponse
from django.core.urlresolvers import reverse
from .models import *

# Create your views here.

def hello(request):

    return HttpResponse('hello world!')


def city(request):

    data=Citys.objects.filter(level=1)

    return render(request,'city.html',{'citys':data})




def get_city(request):

    upid=request.GET.get('id')

    data=Citys.objects.filter(upid=upid).values()

    return JsonResponse(list(data),safe=False)

